﻿@model MvcGrabBag.Web.FileUpload.UploadedFile

@{
    var cssClass = ViewData.ModelState.IsValidField(ViewData.TemplateInfo.HtmlFieldPrefix) ? "" : "input-validation-error";    
}


<div class="@cssClass">
    @if(Model != null && Model.FileName != null)
    {
        <div>
            <span>This file has already been uploaded. Click "Browse..." to overwrite it with a new file</span>
            <br />
            <span>Current file</span>
            <br/>
            <a href= "@Url.Action("OpenFile", "UploadedFile", new { fileName = Model.FileName })" target="_blank">@Model.FileName</a>
        </div>
    }

    <input type="file" name="@ViewData.TemplateInfo.GetFullHtmlFieldName("NewFile")"/>

    @Html.HiddenFor(m => m.NewFile)

</div>